import time

from yk.Base.Base import Base
from selenium import webdriver
from selenium.webdriver.common.by import By


class Page(Base):
    # 断言账号登录
    dy1_loc = (By.XPATH, '//*[@id="normalLoginTab"]/h2')

    def dy1(self):
        self.text(self.dy1_loc)

    # 输入用户名
    username_loc = (By.NAME, 'email')

    def username(self):
        self.send_keys(self.username_loc, '18790225065')

    # 输入密码
    password_loc = (By.NAME, 'password')

    def password(self):
        self.send_keys(self.password_loc, '123456Aa')

    # 点击登录
    login_loc = (By.ID, 'dologin')

    def login(self):
        self.cilck(self.login_loc)

    def text_01(self):
        self.driver.get('https://163.com/')
        # 断言账号登录
        print(self.dy1())
        # 进入框架
        self.jinru('//*[@id="x-URS-iframe1760319885570.4688"]')
        time.sleep(3)
        self.username()
        self.password()
        # 隐式等待
        self.driver.implicitly_wait()
        self.login()
        # 强制等待
        time.sleep(3)
        # 退出框架
        self.tui()
